<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
     var name=1;
     function test() {
        return name;
     }
     var test1={
         a:test()
     }
     console.log(test1.a);
     name=2;
     console.log(test1.a);
</script>
</body>
</html>